#ifndef MAINTENANCEANDCORRECTION_H
#define MAINTENANCEANDCORRECTION_H

#include <QObject>
#include <CommonHelper.h>
#include <Tcpclient.h>
#include <UdpClient.h>
#include <LogHelper.h>
#include <DbHelper.h>
#include <QSerialPortInfo>
#include <SpeechModuleThread.h>
#include <QFileDialog>
#include <algorithm>
#include <QtMath> // 对于 qFloor, qCeil, qRound
#include <QJsonArray>
#include <QJsonObject>

class MaintenanceAndCorrection: public QObject
{
    Q_OBJECT
public:
    MaintenanceAndCorrection();
    ~MaintenanceAndCorrection();

    Q_INVOKABLE void restoreInitialState();
    Q_INVOKABLE void stop();
    Q_INVOKABLE void reset(QString,QString,QString);
    Q_INVOKABLE int getSyringNum(QString);
    Q_INVOKABLE void singleStop(QString);

    //注射器
    Q_INVOKABLE QVariantList getSyringInfo();
    Q_INVOKABLE QVariantList getSyringDetails(QString);
    Q_INVOKABLE bool delSyring(QString);
    Q_INVOKABLE bool saveSyring(QString,QString,QString,QVariantList);
    Q_INVOKABLE QStringList canInsertConsumablesType();

    Q_INVOKABLE void runningSyring(QString,QString,QString,QString);
    Q_INVOKABLE QStringList calculateSteps(QString,QString,QString,QString,QString,QString);
    Q_INVOKABLE QString getSerial();
    Q_INVOKABLE QString checkSyringParameter(QString,QString,QString,QString,QString,QString,QString,QString);
    Q_INVOKABLE int exportSyringConfig(QString);
    Q_INVOKABLE int importSyringConfig();

    //转盘
    Q_INVOKABLE void readPos(QString);
    Q_INVOKABLE void turnTurnTable(QString,QString);
    Q_INVOKABLE void saveData();
    Q_INVOKABLE void setInitialPosition(QString,QString);

    //气泵
    Q_INVOKABLE void setAirPumpPressure(QString,QString);
    Q_INVOKABLE void readAirPumpPressure();


    //通信日志
    Q_INVOKABLE QVariantList getLog();
    Q_INVOKABLE void delLog();
    Q_INVOKABLE void exportLog();

    //故障信息维护
    Q_INVOKABLE QJsonArray getFaultInformation(QString);
    Q_INVOKABLE void updateFaultInformation(QString,QString,QString,QString,QString);
    Q_INVOKABLE bool addFaultInformation(QString);

private:
    CommonHelper *common;
    Loghelper *log;
    UdpClient *udpClient;

};
#endif // MAINTENANCEANDCORRECTION_H
